package com.xmy.cultivate.service.impl;

import com.xmy.cultivate.entity.Station;
import com.xmy.cultivate.mapper.StationMapper;
import com.xmy.cultivate.service.IStationService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 岗位表 服务实现类
 * </p>
 *
 * @author hpiggy
 * @since 2024-01-31
 */
@Service
public class StationServiceImpl extends ServiceImpl<StationMapper, Station> implements IStationService {

    @Autowired
    StationMapper stationMapper;

    @Override
    public String getStationNameForId(Long id){
        return stationMapper.getStationNameForId(id);
    }
    @Override
    public List<Station> recruitmentName() {
        return stationMapper.recruitmentName();
    }

    @Override
    public List<Station> getSchoolOrDepartList(){
        return stationMapper.getSchoolOrDepartList();
    }


    @Override
    public List<Station> getStationListForSchool(Long schoolIdOrDepartmentId){
        Integer type = 1;//校区岗，部门岗
        Integer count = stationMapper.stationType(schoolIdOrDepartmentId);
        if (count > 0){
            type = 2;
        }
        return stationMapper.getStationList(schoolIdOrDepartmentId,type);
    }

}
